<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>京城男人帮---详情</title>
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/home/css/head.css" />
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/home/css/footer.css" />
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/home/css/iemt.css" />
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/home/css/index.css"/>
	<script src="__PUBLIC__/home/js/jquery-1.7.2.min.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
	    $(function(){
	    	//添加商品数量
	    	$(".wrap_input .btn-add").click(function(){
	    		//获得input值
	    		var y = $("#buy_num").val();
	    		//转整
	    		x = parseInt(y)+1;
	    		kc = $(".wrap_input span").text();
	    		kc = parseInt(kc)
	    		if(x<=kc){
	    			$("#buy_num").val(x);

		    		var obj = $(".detail_color ul li.checked");
			        var a_price = 0;
			        // 获取以前的商品价格
	        		var goods_price = "<?php echo $goodsDataOne['0']['g_price'] ?>";
			        // 循环添加属性价格
			        $.each(obj,function(){
			            // 获取选中的属性价格
			            var li_price = $(this).attr("a_price");
			            a_price = parseInt(a_price) + parseInt(li_price);
			        })
			        // 计算总价格
			        goods_price = parseInt(a_price) + parseInt(goods_price);
				    goods_price = goods_price * x;
			        $(".detail_price .price_now span").text(goods_price);
	    		}
	    	});
	    	//添加商品数量
	    	$(".wrap_input .btn-reduce").click(function(){
	    		//获得input值
	    		var y = $("#buy_num").val();
	    		//转整
	    		x = parseInt(y)-1;
	    		if(x>0){
	    		   	$("#buy_num").val(x); 

	    		   	var obj = $(".detail_color ul li.checked");
			        var a_price = 0;
			        // 获取以前的商品价格
        			var goods_price = "<?php echo $goodsDataOne['0']['g_price'] ?>";
			        // 循环添加属性价格
			        $.each(obj,function(){
			            // 获取选中的属性价格
			            var li_price = $(this).attr("a_price");
			            a_price = parseInt(a_price) + parseInt(li_price);
			        })
			        // 计算总价格
			        goods_price = parseInt(a_price) + parseInt(goods_price);
				    goods_price = goods_price * x;
			        $(".detail_price .price_now span").text(goods_price);
	    		}
	    		
	    	});
	    });
	
	</script>
	<script type="text/javascript">
        function over(){
            var div = document.getElementById('alltype');//获取大div对象
            var text = document.getElementById('indextype');//获取文字div对象
            text.style.display="block";
        }//鼠标进入显示文字
        function out(){
            var div = document.getElementById('alltype');
            var text = document.getElementById('indextype');
            text.style.display="none";
        }//鼠标退出不显示文字

        $(function(){
        	//添加一个属性点击事件
	    	$(".detail_color .color_ul li").click(function(){
	    		//切换颜色
	    		$(this).addClass("on").siblings().removeClass("on");
	    	});
        	//添加一个商品介绍点击事件
			$(".con_content .con_tab .w1200 #tuijian li").click(function(){
				var n = $(this).index();
				//切换颜色
				$(".con_content .con_tab .w1200 #tuijian li").eq(n).addClass("on").siblings().removeClass("on");
				//切换商品
				$(".con_content .display .goods_box").eq(n).show().siblings(".goods_box").hide();
			})
        })
    </script>
    <style type="text/css" media="screen">
    	/*菜单样式*/
        #indextype{position: relative;float: left;top: 0;left: 50%;margin-left: -600px;width: 215px;height: 380px;background-color: #C81623;z-index: 4;}

		/*放大镜样式*/
        #content {position: relative;}
        #box {border: 1px solid #000;position: relative;}
        #filter {width: 200px;height: 200px;background: #000;opacity: 0.2;position: absolute;left: 0;top: 0;display: none;cursor: move;}
        .als-item {margin: 0 10px;border: 1px solid #fff;}
        .als-item:hover {border-color: #000;}
        #max {position: absolute;left: 35%;top: 50%;overflow: hidden;z-index:-1;}
        #maxImg {width: 800px;height: 800px;position: absolute;left: 35%;top: 50%;}
    </style>
</head>
<body>
	<!--顶部公用-->
	{include file="public/top"}
    <!--头部end-->
	<!-- 菜单 -->
    {include file="public/all_type"}
    <!-- 菜单 -->
	<div class="w1200">
		<!--分类导航-->
    	<div class="top_nv">
    	</div>
    	<!--分类导航-->

		<?php if(!empty($goodsDataOne)){ ?>
		<div class="con_content">
			<!--提交区域-->
			<div class="con_top">
				<div class="con_top_l">
					<!-- 商品图片放大镜和各个方面的图片 -->
					<div class="tab-w">
						<!--放大镜-->
						<div class="divw" id="ccontent">
							<a href="">
								<span class="zoomPad" id="box">
    								<img src="__PUBLIC__/<?php echo $goodsDataOne['0']['g_img'] ?>" jqim="__PUBLIC__/home/image/con_c_1.png" class="middle"/>
    								<div id="filter"></div>
    							  <!-- <div style="top: 148px; left: 153.5px; width: 180px; height: 180px;position: absolute; border-width: 1px; display: none;" class="zoomPup"></div>
    								<div style="position: absolute; z-index: 500; left: 390px; top: 0px;display: none;" class="zoomWindow">
    									<div style="width: 380px;" class="zoomWrapper"><div style="width: 100%; position: absolute; display: block;" class="zoomWrapperTitle"></div>
    									    <div style="width: 100%; height: 380px;" class="zoomWrapperImage"><img src="__PUBLIC__/home/image/con_c_2.png" style="position: absolute; border: 0px none; display: block; left: -5000px; top: 0px; width: 800px; height: 800px;">
    									    </div>
    									</div>
    							   </div> -->
    							</span>
    							<span class="zoomPad" id="max">
    								<img src="__PUBLIC__/<?php echo $goodsDataOne['0']['g_img'] ?>" id="maxImg">
    							</span>
							</a>
						</div>
						<!--放大镜-->
						<!--tab,ajax-->
						<div class="box-tab">
							<div class="ul-w">
								<ul class="als-wrapper">
									<li class="als-item">
										<a href="javascript:;"><img src="__PUBLIC__/<?php echo $goodsDataOne['0']['g_img'] ?>" data-url="__PUBLIC__/<?php echo $goodsDataOne['0']['g_img'] ?>" onmousemove="preview(this);" /></a>
									</li>
								<?php if (!empty($goodsImg)){ ?>
								<?php foreach ($goodsImg as $key => $value){ ?>
									<li class="als-item">
										<a href="javascript:;"><img src="__PUBLIC__/<?php echo $value['g_url'] ?>" data-url="__PUBLIC__/<?php echo $value['g_url'] ?>" onmousemove="preview(this);" /></a>
									</li>
								<?php }} ?>
								</ul>
							</div>
							<div class="g_t_l_hd">
								<span id="prev" class="btn l als-prev"></span>
								<span id="next" class="btn r als-next"></span>
							</div>
						</div>
						<!--tab,ajax-->
					</div>
					<!-- 商品图片放大镜和各个方面的图片 -->
					<div class="detail_share">
					<!-- 商品收藏 -->
						<?php if (!empty($collectOne)){ ?>
							<?php if ($collectOne['0']['sc_statc'] == 0){ ?>
								<div class="detail_sc" id="collect" state="1">
									<i class="i_addsc"></i> 收藏商品
								</div>
							<?php }else{ ?>
								<div class="detail_sc" id="collect" state="0">
									<i class="i_addsc"></i> 取消收藏
								</div>
							<?php } ?>
						<?php }else{ ?>
							<div class="detail_sc" id="collect">
								<i class="i_addsc"></i> 收藏商品
							</div>
						<?php } ?>
					<!-- 商品收藏 -->
					</div>
				</div>
				<!-- 商品属性 -->
				<div class="con_top_r">
					<div class="detail_top">
					<!-- 该商品id -->
					<input type="hidden" id="g_id" name="g_id" value="<?php echo $goodsDataOne['0']['g_id'] ?>">
						<!-- 商品名称 -->
						<h1 class="detail_tit"></h1>
						<h2 class="detail_tit_md"><?php echo $goodsDataOne['0']['g_name'] ?></h2>
						<div class="price_wrap">
							<div class="detail_price">
								<span class="price_now">
    								<b class="em_sign">￥</b>
    								<span><?php echo $goodsDataOne['0']['g_price'] ?></span>
    							</span>
							</div>
							<div class="d_bh">编号：<?php echo $goodsDataOne['0']['g_id'] ?> </div>
						</div>
						<div class="detail_freight">
							<span class="pop_tit ">运费：</span>
							<span id="freight" class="pop_black">包邮</span>
						</div>

						<!-- 属性 -->
						<div class="detail_color">
						<?php if (!empty($array)){ ?>
						<?php foreach ($array as $key => $value){ ?>
							<div class="model_wrap color_wrap" id="shuxing">
								<span class="pop_tit" a_value_id="<?php echo $value['a_id'] ?>"><?php echo $value['a_name'] ?>：</span>
								<ul class="color_ul" id="shux">
								<?php foreach ($value['aa_id'] as $key => $val){ ?>
									<li class="" a_price="<?php echo $val['a_price'] ?>" a_value_id="<?php echo $val['a_value_id'] ?>">
										<a href="javascript:void(0)" data-param="{valid:51008, key:1}"><?php echo $val['a_name'] ?></a>
										<b></b>
									</li>
								<?php } ?>
								</ul>
							</div>
						<?php } ?>
						<?php } ?>
							<div class="detail_color">
								<span class="pop_tit">库存：</span>
								<div class="wrap_input">
									<span style="color: red;"><?php echo $goodsDataOne['0']['g_number'] ?></span>&nbsp;件
								</div>
							</div>
							<div class="model_wrap count_wrap">
								<span class="pop_tit">数量：</span>
								<div class="wrap_input">
									<a href="javascript://" data-param="0" class="btn-add">-</a>
									<a href="javascript://" data-param="0" class="btn-reduce">+</a>
									<input value="1" id="buy_num" class="text" onkeyup="this.value=this.value.replace(/\D/g, '');">
								</div>
							</div>
							<div class="model_wrap">
								<div class="model_submilt">
									<div class="btn_goods_remind" style="background: #FF7F00;color: #fff;border: 0px;">
							    		<span><h4><b class="b_car1"></b>加入购物车</h4></span>
							    	</div>
							    </div>
								<!-- <div class="detail_ewm">
									<p class="ewm_bg_img"></p>
									<p>
										<span class="fs_14">微信 支付宝</span>
										<span class="fs_14">直播商品订购减 20 元</span>
									</p>
								</div> -->
							</div>
						</div>
					</div>
				</div>
			</div>
			<!--提交区域end-->

			<!--展示区域-->
			<div class="con_tab">
				<div class="con_nav">
					<div class="con_nav_c">
						<div class="w1200">
							<ul class="color_ul" id="tuijian">
								<li class="on"><a href="javascript:;">商品详情</a></li>
								<li><a href="javascript:;">商品参数</a></li>
								<!-- <li><a href="javascript:;">用户评价</a></li> -->
								<li><a href="javascript:;">为您推荐</a></li>
							</ul>
							<!-- <div class="fix_add_car">
								<div class="db_price">
									<em>¥</em>
								</div>
								<a class="fixed_add_car" href="javascript:;">加入购物车</a>
							</div> -->
						</div>
					</div>
				</div>
			</div>
			<div class="display">
				<!-- 商品详情 -->
				<div class="goods_box"  style="display: block;">
					<div class="detail_lists">
						<div class="d_h2">
							<h2>商品详情</h2>
						</div>
						<div class="detail_con">
							<div style="margin: auto;">
								<p><img src="__PUBLIC__/home/image/d_1.jpg" /></p>
							</div>
							<div style="margin: auto;">
								<img src="__PUBLIC__/home/image/d_2.jpg" />
								<img src="__PUBLIC__/home/image/d_3.jpg" />
								<img src="__PUBLIC__/home/image/d_4.jpg" />
								<img src="__PUBLIC__/home/image/d_5.jpg" />
								<img src="__PUBLIC__/home/image/d_6.jpg" />
								<img src="__PUBLIC__/home/image/d_7.jpg" />
							</div>
							<div style="margin: auto;">
								<p><img src="__PUBLIC__/home/image/d_8.jpg" /></p>
							</div>
						</div>
					</div>
				</div>
				<!-- 商品参数 -->
				<div class="goods_box"  style="display: none;">
					<div class="detail_lists">
						<div class="d_h2">
							<h2>商品参数</h2>
						</div>
						<div class="detail_con_l">
							<ul>
								<li>
									<div class="d_l_con1_l">主商品配套：</div>
									<div class="d_l_con1_r">乐途女士后跟杯款经典跑鞋</div>
								</li>
								<li>
									<div class="d_l_con1_l">材质是否防水：</div>
									<div class="d_l_con1_r">否</div>
								</li>
								<li>
									<div class="d_l_con1_l">鞋垫是否固定：</div>
									<div class="d_l_con1_r">是</div>
								</li>
								<li>
									<div class="d_l_con1_l">是否具备气垫：</div>
									<div class="d_l_con1_r">否</div>
								</li>
								<li>
									<div class="d_l_con1_l">型号（品牌运动鞋）：</div>
									<div class="d_l_con1_r">ERCL002-1 ERCL002-2</div>
								</li>
								<li>
									<div class="d_l_con1_l">是否为标准尺码：</div>
									<div class="d_l_con1_r">是</div>
								</li>
								<li>
									<div class="d_l_con1_l">颜色：</div>
									<div class="d_l_con1_r">ERCL002-1：康乃馨红/海棠红/白 ERCL002-2：馨香紫/风信紫/白</div>
								</li>
								<li>
									<div class="d_l_con1_l">配套赠品（无编号）：</div>
									<div class="d_l_con1_r">乐途斜挎包</div>
								</li>
							</ul>
						</div>
					</div>
				</div>
				<!-- 用户评价 -->
				<!-- <div class="goods_box"  style="display: none;">
				    		    	<div class="detail_lists">
				    		    		<div class="d_h2 ">
				    		    			<h2>用户评价</h2>
				    		    		</div>
					    		    	<div class="detail_l_con3 ">
					    		    		<div class="appraise_h2 ">
					                            <div class="appraise_t1 ">评价心得</div>
					                            <div class="appraise_t2 ">用户满意度</div>
					                            <div class="appraise_t3 ">购买价格</div>
					                            <div class="appraise_t4 ">用户信息</div> 
					    		    		</div>
					    		    		<ul>
					    		    			<li class="appraise_li ">
					    		    				<div class="a_li_t1 ">
					    		    					<div class="appr_cons ">很轻，很舒适^_^</div>
					                                    <div class="appr_time ">2016-05-19 12:27</div>
					    		    				</div>
					    		    				<div class="a_li_t2 ">
					    		    					<i class="i_icon_csi i_satisfy "></i>
					    		    					<i class="i_icon_csi i_satisfy "></i>
					                                    <i class="i_icon_csi i_satisfy "></i>
					                                    <i class="i_icon_csi i_satisfy "></i>
					                                    <i class="i_icon_csi "></i>                                           
					    		    				</div>
					    		    				<div class="a_li_t3 ">
					    		    					<p class="p_p ">￥<span>298.00</span></p>
					    		    				</div>
					    		    				<div class="a_li_t4 ">
					    		    					<img src="__PUBLIC__/home/image/user_center_img4.jpg "><br><span>MB***</span>
					    		    				</div>
					    		    			</li>
					    		    			<li class="appraise_li ">
					    		    				<div class="a_li_t1 ">
					    		    					<div class="appr_cons ">很轻，很舒适^_^</div>
					    		    					反馈图片
					    		    					<div class="appraise_img ">
					    		    						<ul class="appr_img_list ">
					    		    							<li><img src="__PUBLIC__/home/image/pinlun_1.jpg "/></li>
					    		    						</ul>
					    		    					</div>
					    		    					反馈图片
					                                    <div class="appr_time ">2016-05-19 12:27</div>
					                                    卖家回复
					                                    <div class="call_me_back ">
					                                    	客服回复：<span>您好！感谢您对我们的支持和开发商品提出的宝贵建议，您的建议就是我们的动力，我们会继续努力的，请您继续关注我们哦！</span>
					                                    </div>
					                                    卖家回复
					    		    				</div>
					    		    				<div class="a_li_t2 ">
					    		    					<i class="i_icon_csi i_satisfy "></i>
					    		    					<i class="i_icon_csi i_satisfy "></i>
					                                    <i class="i_icon_csi i_satisfy "></i>
					                                    <i class="i_icon_csi i_satisfy "></i>
					                                    <i class="i_icon_csi "></i>                                           
					    		    				</div>
					    		    				<div class="a_li_t3 ">
					    		    					<p class="p_p ">￥<span>298.00</span></p>
					    		    				</div>
					    		    				<div class="a_li_t4 ">
					    		    					<img src="__PUBLIC__/home/image/user_center_img4.jpg "><br><span>MB***</span>
					    		    				</div>
					    		    			</li>
					    		    			<li class="appraise_li ">
					    		    				<div class="a_li_t1">
					    		    					<div class="appr_cons ">很轻，很舒适^_^</div>
					                                    <div class="appr_time ">2016-05-19 12:27</div>
					    		    				</div>
					    		    				<div class="a_li_t2 ">
					    		    					<i class="i_icon_csi i_satisfy "></i>
					    		    					<i class="i_icon_csi i_satisfy "></i>
					                                    <i class="i_icon_csi i_satisfy "></i>
					                                    <i class="i_icon_csi i_satisfy "></i>
					                                    <i class="i_icon_csi "></i>                                           
					    		    				</div>
					    		    				<div class="a_li_t3 ">
					    		    					<p class="p_p ">￥<span>298.00</span></p>
					    		    				</div>
					    		    				<div class="a_li_t4 ">
					    		    					<img src="__PUBLIC__/home/image/user_center_img4.jpg "><br><span>MB***</span>
					    		    				</div>
					    		    			</li>
					    		    		</ul>
					    		    	</div>
				    		    	</div>
				    		    </div> -->
    		    <!-- 为你推荐 -->
    		    <div class="goods_box"  style="display: none;">
    		    	<div class="detail_lists">
    		    		<div class="d_h2">
    		    			<h2>为您推荐</h2>
    		    		</div>
    		    		<div class="detail_l_con4">
    		    			<div class="d_l_con4_list">
    		    				<ul>
    		    				<?php if (!empty($goodsDataTuijian)){ ?>
    		    				<?php foreach ($goodsDataTuijian as $key => $value){ ?>
    		    					<li>
    		    						<a href="{:url('home/shop/iemt')}?c_id=<?php echo $value['c_id'] ?>&g_id=<?php echo $value['g_id'] ?>" class="a_con4_list">
    		    							<p class="p_img"><img src="__PUBLIC__/<?php echo $value['g_img'] ?>"/></p>
    		    							<p class="p_title"><?php echo $value['g_name'] ?></p>
    		    							<p class="p_price">
    		    								<span class="price1">￥<span><?php echo $value['g_price'] ?></span></span>
    		    							</p>
    		    						</a>
    		    					</li>
    		    				<?php } ?>
    		    				<?php } ?>
    		    				</ul>
    		    		    </div>
    		    		    <div class="hd">
    		    		    	<a href="javascript:;" class="prev"><</a>
    		    		    	<a href="javasc ript:;" class="next">></a>
    		    		    </div>
    		    		</div>
    		    	</div>
    		    </div>
			</div>
    		<!--展示区域end-->
    	</div>
    	<?php }else{ ?>
    	<div class="con_content">
			没有该商品
		</div>
		<?php } ?>
    </div>
   	<!--底部公用-->
	{include file="public/footer"}
	<!--底部end-->
	<!--左侧导航-->
	{include file="public/left"}
	<!--左侧导航-->
</body>
</html>
<script>
	// 属性价格
	$(".detail_color ul li").click(function(){
        _this = $(this);
        // 添加checked类  让点击的属性值选中
        _this.addClass("checked");
        // 去除同辈的类    让同一个属性只能选一个
        _this.siblings().removeClass("checked");
        // 获取以前的商品价格
        var goods_price = "<?php echo $goodsDataOne['0']['g_price'] ?>";
        // 获取被选中的属性
        var obj = $(".detail_color ul li.checked");
        var a_price = 0;
        // 循环添加属性价格
        $.each(obj,function(){
            // 获取选中的属性价格
            var li_price = $(this).attr("a_price");
            a_price = parseInt(a_price) + parseInt(li_price);
        })
        // alert(a_price);
        // 计算总价格
        goods_price = parseInt(a_price) + parseInt(goods_price);
        // 获取数量input的值
        var shul = $("#buy_num").val();
	    goods_price = goods_price * shul;

        $(".detail_price .price_now span").text(goods_price);
    })
	// 收藏
	$(document).on("click","#collect",function(){
		var g_id = $(".detail_top #g_id").val();
		var sc_statc = $(this).attr("state");
		if(sc_statc==''){
			var bool = confirm("您还未登陆，是否去登录");
			if(bool==true){
				window.location.href = "{:url('home/user/login')}"
			}
			return;
		}else if(sc_statc==1){
			var bool = confirm("确定收藏");
		}else{
			var bool = confirm("确定取消收藏");
		}
		if (bool == true) {
			$.ajax({
				url:"collectAdd",
	            data:{g_id:g_id,sc_statc:sc_statc},
	            dataType:"json",
	            success:function(res){
	                alert("收藏成功");
	                location.href=location.href;
	            }
			})
		}
	})
</script>
<script>

 	/*
        建议 小方块 中图  以及大图的比例是 1:2:4
     */
    var aSmall = document.querySelectorAll(".als-item");
    var omiddle = document.querySelector(".middle");
 
    var oBox = document.getElementById("box");
    var oFilter = document.getElementById("filter");
    var maxImg = document.getElementById("maxImg");
    for (var i = 0; i < aSmall.length; i++) {
        aSmall[i].onmouseover = function () {
            var src = this.getAttribute("data-url");
            omiddle.src = src;
            maxImg.src = src;
        }
    }
 
    /////////////////////////放大镜//////////////////////////
    maxImg.style.display = "none";
    oBox.onmouseover = function () {
        maxImg.style.display = "block";
        oFilter.style.display = "block";
        this.onmousemove = function (e) {
        	max.style.zIndex = '999';
            var e = e || event;
            var l = e.clientX - oFilter.offsetWidth / 2;
            var t = e.clientY - oFilter.offsetHeight / 2;
            l = l >= oBox.offsetWidth - oFilter.offsetWidth ? l = oBox.offsetWidth - oFilter.offsetWidth : (l <= 0 ? l = 0 : l = l);
            t = t >= oBox.offsetHeight - oFilter.offsetHeight ? t = oBox.offsetHeight - oFilter.offsetHeight : (t <= 0 ? t = 0 : t = t);
 
            oFilter.style.left = l + 'px';
            oFilter.style.top = t + 'px';
 
            maxImg.style.left = -2 * l + 'px';
            maxImg.style.top = -2 * t + 'px';
        }
    };
    oBox.onmouseout = function () {
        oFilter.style.display = "none";
        maxImg.style.display = "none";
        max.style.zIndex = '-9';
    }



    //鼠标经过预览图片函数
	function preview(img){
		$("#ccontent .zoomPad img").attr("src",$(img).attr("src"));
		$("#ccontent .zoomPad img").attr("jqimg",$(img).attr("data-url"));
	}
    //图片预览小图移动效果,页面加载时触发
	$(function(){
		var tempLength = 0; //临时变量,当前移动的长度
		var viewNum = 4; //设置每次显示图片的个数量
		var moveNum = 4; //每次移动的数量
		var moveTime = 300; //移动速度,毫秒
		var scrollDiv = $(".box-tab .ul-w ul"); //进行移动动画的容器
		var scrollItems = $(".box-tab .ul-w ul li"); //移动容器里的集合
		var moveLength = scrollItems.eq(0).width() * moveNum; //计算每次移动的长度
		var countLength = (scrollItems.length - viewNum) * scrollItems.eq(0).width(); //计算总长度,总个数*单个长度
		  
		//下一张
		$(".box-tab .g_t_l_hd #next").bind("click",function(){
			if(tempLength < countLength){
				if((countLength - tempLength) > moveLength){
					scrollDiv.animate({left:"-=" + moveLength + "px"}, moveTime);
					tempLength += moveLength;
				}else{
					scrollDiv.animate({left:"-=" + (countLength - tempLength) + "px"}, moveTime);
					tempLength += (countLength - tempLength);
				}
			}
		});
		//上一张
		$(".box-tab .g_t_l_hd #prev").bind("click",function(){
			if(tempLength > 0){
				if(tempLength > moveLength){
					scrollDiv.animate({left: "+=" + moveLength + "px"}, moveTime);
					tempLength -= moveLength;
				}else{
					scrollDiv.animate({left: "+=" + tempLength + "px"}, moveTime);
					tempLength = 0;
				}
			}
		});
	});
</script>
<script>
	$(document).on("click",".btn_goods_remind",function(){
		// 要获取加入购物车的数据
		// goods_id
        var g_id = $(".detail_top #g_id").val();
        // 数量
        var buy_number = $("#buy_num").val();
        // 价格
        var g_price =  $(".detail_price .price_now span").text();
        // 商品名称
        var g_name =  $(".detail_tit_md").text();
        // 定义新数组放属性值
        var v_arr = new Array();
        // 放属性值得id a_value_id
        var id_arr = new Array();
        // 属性值 组合 内存：128G 颜色：黑色
        var obj = $(".detail_color ul li.checked");
        $.each(obj,function(i,v){
            // 属性值
            var val = $(this).text();
            // 属性名
            var val_name = $(this).parent().prev().text();
            v_arr.push(val_name+val);
            // 获取id
            var id = $(this).attr("a_value_id");
            var pid = $(this).attr("a_value_id");
            var ids = id+","+pid;
            id_arr.push(ids);
        })
        // 判断有没有选属性
        var attr_num = "<?php echo count($array); ?>";
        if(id_arr.length != attr_num){
            alert("请选择所有的规格");
            return;
        }
		// 发送ajax
        $.ajax({
            url:"cartAdd",
            data:{g_id:g_id,buy_number:buy_number,g_price:g_price,g_name:g_name,id_arr:id_arr,v_arr:v_arr},
            dataType:"json",
            success:function(res){
                alert(res.msg);
                if(res.url){
                    location.href = res.url;
                }
                // console.log(res);
            }
        })
	})
</script>